package de.lmu.mvs.lerngruppenfinder.interests;

import de.lmu.mvs.lerngruppenfinder.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

public class InterestView extends LinearLayout {

	private LinearLayout mContainer;
	
	private ListView mListView;
	
	private TextView mTextView;
	
	public InterestView(Context context) {
		this(context, null);
		setupLayout(context);
	}

	public InterestView(Context context, AttributeSet attrs) {
		super(context, attrs);

		TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ExpandablePanel, 0, 0);       
		a.recycle();
		
		setupLayout(context);
	}

	private void setupLayout(Context context) {
		mContainer = new LinearLayout(context);
		mContainer.setLayoutParams(new LinearLayout.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		
		mTextView = new TextView(context);
		mTextView.setText("test");
		mTextView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 0.3f));
		
		mListView = new ListView(context);
		mListView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 0.7f));
		
		mContainer.addView(mTextView);
		mContainer.addView(mListView);
	}
}
